//package com.example.shardingjdbcdemo.config;
//
//import com.google.common.collect.BoundType;
//import com.google.common.collect.Range;
//import org.apache.shardingsphere.sharding.api.sharding.standard.PreciseShardingValue;
//import org.apache.shardingsphere.sharding.api.sharding.standard.RangeShardingValue;
//import org.apache.shardingsphere.sharding.api.sharding.standard.StandardShardingAlgorithm;
//
//import java.util.Collection;
//import java.util.Collections;
//import java.util.Properties;
//
//public class TenModShardingAlgorithm implements StandardShardingAlgorithm<Long> {
//    @Override
//    public String doSharding(Collection<String> collection, PreciseShardingValue<Long> preciseShardingValue) {
//        for (String tableName : collection) {
//            if (tableName.endsWith(String.format("%d", preciseShardingValue.getValue() % 10))) {
//                return tableName;
//            }
//        }
//        throw new IllegalArgumentException();
//    }
//
//    @Override
//    public Collection<String> doSharding(Collection<String> collection, RangeShardingValue<Long> rangeShardingValue) {
////        Range<Long> valueRange = rangeShardingValue.getValueRange();
////        Long low = valueRange.lowerEndpoint();
////        Long upper = valueRange.upperEndpoint();
////        if (boundType == BoundType.CLOSED) {
////            return Collections.singletonList(String.format("%d", valueRange.lowerEndpoint() % 10));
////        }
////        if (boundType == BoundType.OPEN) {
////            return Collections.singletonList(String.format("%d", (valueRange.lowerEndpoint() + 1) % 10));
////        }
////        return Collections.emptyList();
//    }
//
//    @Override
//    public Properties getProps() {
//        return null;
//    }
//
//    @Override
//    public void init(Properties properties) {
//
//    }
//}
